package cn.tuling.staitc;

public class StaticProxyTest {
    public static void main(String[] args) {
        Specialty specialty = new ZiboSpecialty();
        Specialty proxy = new SpecialtyProxy(specialty);
        proxy.display();
    }
}

interface Specialty {
    void display();
}

class ZiboSpecialty implements Specialty {

    @Override
    public void display() {
        System.out.println("淄博特产港香莲~");
    }
}

class SpecialtyProxy implements Specialty {
    private Specialty ziboSpecialty;

    public SpecialtyProxy(Specialty ziboSpecialty) {
        this.ziboSpecialty = ziboSpecialty;
    }

    public void preDisplay() {
        System.out.println("前置处理");
    }

    @Override
    public void display() {
        preDisplay();
        ziboSpecialty.display();
        postDisplay();
    }

    public void postDisplay() {
        System.out.println("后置处理");
    }
}